package reference;

/**
 * @author hujian
 * @date 2023/2/15 15:20
 * @description
 */
public class ReferenceAnalyzer {
    public static void main(String[] args) {
        String reference = "参考文献字符串";
        double gbtScore = analyzeGBT(reference);
        double mlaScore = analyzeMLA(reference);
        double apaScore = analyzeAPA(reference);
        System.out.println("GB/T 7714-2015得分：" + gbtScore);
        System.out.println("MLA得分：" + mlaScore);
        System.out.println("APA得分：" + apaScore);
        if (gbtScore >= mlaScore && gbtScore >= apaScore) {
            System.out.println("参考文献与GB/T 7714-2015标准相关性最高");
        } else if (mlaScore >= gbtScore && mlaScore >= apaScore) {
            System.out.println("参考文献与MLA标准相关性最高");
        } else if (apaScore >= gbtScore && apaScore >= mlaScore) {
            System.out.println("参考文献与APA标准相关性最高");
        }
    }

    private static double analyzeGBT(String reference) {
        // GB/T 7714-2015分析规则
        double score = 0;
        if (reference.matches("GB/T 7714-2015规则1")) {
            score += 0.3;
        }
        if (reference.matches("GB/T 7714-2015规则2")) {
            score += 0.2;
        }
        if (reference.matches("GB/T 7714-2015规则3")) {
            score += 0.1;
        }
        // ...
        return score;
    }

    private static double analyzeMLA(String reference) {
        // MLA分析规则
        double score = 0;
        if (reference.matches("MLA规则1")) {
            score += 0.3;
        }
        if (reference.matches("MLA规则2")) {
            score += 0.2;
        }
        if (reference.matches("MLA规则3")) {
            score += 0.1;
        }
        // ...
        return score;
    }

    private static double analyzeAPA(String reference) {
        // APA分析规则
        double score = 0;
        if (reference.matches("APA规则1")) {
            score += 0.3;
        }
        if (reference.matches("APA规则2")) {
            score += 0.2;
        }
        if (reference.matches("APA规则3")) {
            score += 0.1;
        }
        // ...
        return score;
    }
}
